/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package orgarqsindex.linkedlist;

/**
 *
 * @author Fernando Molon Toigo e Dyoni Bertuol
 */
public class LinkedListValueNode {

    private String value;
    protected LinkedListValueNode nextValue;
    protected LinkedListAddressNode nextAddress;

    public LinkedListValueNode(String value) {
        this.value = value;
    }

    public String getValue() {
        return value;
    }

    void insert(String value, long address) {
        if (value.compareToIgnoreCase(this.value) == 0) {
            LinkedListAddressNode newAddress = new LinkedListAddressNode(address);
            newAddress.nextAddress = this.nextAddress;
            this.nextAddress = newAddress;
        } else {
            if (nextValue == null) {
                nextValue = new LinkedListValueNode(value);
            }
            nextValue.insert(value, address);
        }
    }
}
